package com.zlf.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zlf.entity.PermissionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author zhanglongfei
 * @since 2021-05-24
 */
@Mapper
public interface PermissionMapper extends BaseMapper<PermissionEntity> {

    /*
    根据角色id查询权限
     */
    @Select("select p.id,p.name,p.url from t_permission p left join t_role_permission rp on rp.permission_id = p.id where rp.role_id = #{roleId}")
    List<PermissionEntity> getPermissionsByRoleId(Integer roleId);

}
